﻿<script type="text/template" id="list-book-item-template">
@{
    const string edit = " <a href=\"javascript:void(0)\" class=\"grid-update-book\"><%= jsResources.lang.GridEdit %></a> ";
    const string delete ="<a href=\"javascript:void(0)\" class=\"grid-delete-book\"><%= jsResources.lang.GridDelete %></a> ";
    const string copy = "<a href=\"javascript:void(0)\" class=\"grid-copy-book\"><%= jsResources.lang.GridCopy %></a>";
}
    <td class="text-center">
        <%= model.Order %>
    </td>
    <td>
        <%= model.Name %>
    </td>
    <td>
        <%= model.BookTypeName %>
    </td>
    <td>
        <%= model.OfficeNameUse %>
    </td>
    <td>
        <%= model.CurrentNumber %>
    </td>
    <td>
        <%= model.Format %>
    </td>
    <td>
        <%= model.ResetName %>
    </td>
    <td>
        <%= dateFormat( model.UpdatedAt, jsResources.lang.DateFormat) %>
    </td>
    <td>
       <input type="checkbox"  <%= model.IsActive == true ? 'checked="checked"' : '' %> name = "IsActive" class="cbxIsActive" />
    </td>
    <td>
       <input type="checkbox"  <%= model.IsDefault == true ? 'checked="checked"' : '' %> name = "IsDefault" class="cbxIsDefault" />
    </td>
    <td>
        @Html.Raw(edit)  
    </td>
    <td>
        @Html.Raw(delete)              
    </td>
    <td>
        @Html.Raw(copy)
    </td>
</script>

<script type="text/template" id="book-form-template">
    <div id="book-form-error" class="error"></div>
    <form id="book-form" onsubmit="return false;">
        <ul class="idata-form">
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookName %>    
                </span>
                <span>
                    <input type="text" name="Name" id="Name" required value="<%= model.Name %>"/>
                </span>
            </li>
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookOfficeUse %>
                </span>
                <span>
                    <span style="color:red;"><%= model.OfficeNameUse %></span>
                    
                    <input type="text" value ="<%= model.OfficeIdUse %>" name="OfficeIdUse" style="width:1px;height:24px;border:0" id="OfficeIdUse" required />
                </span>
                <span>
                    <a href="javascript:void(0)" class="btn-change-dept" ><%= jsResources.lang.ManageBookOfficeBtnChange %></a>                    
                </span>
            </li>
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookDescription %>    
                </span>
                <span>
                    <textarea name="Description" id="Description"><%= model.Description %></textarea>
                </span>
            </li>
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookType %>    
                </span>
                <span>
                    <select name="BookType" id="BookType">
                        <%= VH.MakeOption(VOFFICE.ManageBook.BookTypeList, model.BookType) %>
                    </select>
                </span>
            </li>
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookCurrentNumber %>
                </span>
                <span>
                    <input type="text" id="CurrentNumber" name ="CurrentNumber" value="<%= model.CurrentNumber %>" number min="1" /> 
                </span>
            </li>
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookFormat %>
                </span>
                <span>
                    <input type="text" id="Format" name ="Format" value="<%= model.Format %>" /> 
                    <div class="clear"/>
                    <span> <a href="javascript:void(0)" class="suggest">#yy#</a> (<%= dateFormat(new Date(), "yy") %>), <a href="javascript:void(0)" class="suggest">#yyyy#</a> (<%= dateFormat(new Date(), "yyyy") %>), <a href="javascript:void(0)" class="suggest">#mm#</a> (<%= dateFormat(new Date(), "mm" )%>), <a href="javascript:void(0)" class="suggest">#dd#</a> (<%= dateFormat(new Date(), "dd" )%>), <a href="javascript:void(0)" class="suggest">#n#</a> (<%= model.CurrentNumber %>)
                    </span><div class="clear"/>
                    <span style="font-style:italic; font-size:95%; color:Gray">
                        <%= jsResources.lang.ManageBookExampleFormat %>: EX#yy##mm##dd##n# (EX<%= dateFormat(new Date(), "yy") %><%= dateFormat(new Date(), "mm") %><%= dateFormat(new Date(), "dd") %><%= model.CurrentNumber %>)
                    </span>
                </span>
                
            </li>
            <li class="show-reset" style="display : <%= jQuery.trim(model.Format).length > 0 ? "" : "none"%>;">
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookResetBy %>
                </span>
                <span>
                    <select name="ResetBy" id="ResetBy">
                        <%= VH.MakeOption(VOFFICE.ManageBook.ResetByList, model.ResetBy) %>
                    </select>
                </span>
            </li>
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookActive %>    
                </span>
                <span>
                    <input type="checkbox" name = "IsActive" id="IsActive" <%= model.IsActive == true ? 'checked="checked"' : '' %> />
                </span>
            </li>
            
            <li>
                <span class="idata-form-title">
                    <%= jsResources.lang.ManageBookDefault %>    
                </span>
                <span>
                    <input type="checkbox" name = "IsDefault" id="IsDefault" <%= model.IsDefault == true ? 'checked="checked"' : '' %> />
                </span>
            </li>
        </ul>
        <div class="clear"></div>
        <center>
            <input type="submit" value = "<%= model.id == 0 ? jsResources.lang.Create : jsResources.lang.Update %>" id="submit-book"
            class="ui-button ui-widget ui-state-default ui-corner-all ui-state-hover" role="button" aria-disabled="false"/>
        </center>
    </form>
</script>
